<template>
  <div class="content-wrapper">
    <div @click="$emit('click')" class="work-container">
      <div class="pic-container">
        <img :src="item.photo" alt=""/>
      </div>
      <div class="text-container">
        <div class="user-content">
          <div class="content">{{ item.content }}</div>
        </div>
        <!-- <div class="user-content" ref="scrollEl">
          <div class="content">{{ item.content }}</div>
          <div class="custom-vertical-scrollbar" ref="vertical">
              <div class="custom-vertical-indicator"></div>
            </div>
        </div> -->
        <div class="user-sign">——来自“{{item.nickname}}”</div>
      </div>
      <div class="slogon-container"></div>
    </div>
  </div>
</template>
<script>
// import BScroll from '@better-scroll/core'
// import ScrollBar from '@better-scroll/scroll-bar'
// BScroll.use(ScrollBar)
export default {
  name: 'WorkCardComponent',
  mounted () {
    // this.$nextTick(() => {
    //   this.createScroll()
    // })
  },
  props: {
    item: {
      type: Object,
      default: () => {}
    }
  },
  methods: {
    // 创建滚动条
    // createScroll () {
    //   this.scroll = new BScroll(this.$refs.scrollEl, {
    //     scrollY: true,
    //     scrollbar: {
    //       fade: false,
    //       interactive: true,
    //       customElements: [this.$refs.vertical]
    //     },
    //     bindToWrapper: true
    //   })
    //   this.scroll.on('beforeScrollStart', () => {
    //     this.$emit('lock', true)
    //   })
    //   this.scroll.on('touchEnd', () => {
    //     this.$emit('lock', false)
    //   })
    // }
  }
}
</script>
<style lang="scss" scoped>
  @import "../assets/css/mixin.scss";
  .content-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .work-container {
    border-radius: 20px;
    overflow: hidden;
    @include wh(607, 909 + $addHeight);
    width: 607px;
    // min-height: 909px;
    width: 607px;
    padding: 28px 24px 22px 21px;
    position: relative;
    display: inline-block;
    background: url(../assets/img/second/swiper_bg.png) center no-repeat;
    transform: translate3d(0,0,0);
    backface-visibility: hidden;
  }
  .pic-container {
    @include wh(562, 364);
    img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
  }
  .user-content {
    width: 100%;
    background-size: 100% 100%;
    margin-top: 34px;
    font-size: 20px;
    color: #6f5b5c;
    white-space: pre-wrap;
    line-height: 27px;
    text-align: left;
    position: relative;
    min-height: 81px;
    text-align: justify;
    // max-height: 27px * 9;
    overflow: hidden;
  }
  .user-sign {
    font-size: 24px;
    text-align: right;
    color: #8f8586;
    margin-top: 12px;
  }
  .slogon-container {
    @include wh(292, 146);
    background: url(../assets/img/second/slogon.png) center no-repeat;
    background-size: 100% 100%;
    // margin: 21px auto 0;
    @include lb(53, 36);
    position: absolute;
    left: 0;
    right: 0;
    margin:  0 auto;
    bottom: 23px;
  }
  .qrcode-container {
    @include wh(140, 140);
    background-color: #d7d6d5;
    @include rb(37, 28);
    background-color: rgba(191, 191, 191, 0.631);
    border-radius: 28px;
  }
  .custom-vertical-scrollbar {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: 6px;
    border-radius: 6px;
    background-color: transparent;
  }
  .custom-vertical-indicator {
    width: 100%;
    height: 50px;
    border-radius: 6px;
    background-color: #a00d14;
  }
</style>
